package com.jinsi.controller.ylt;

import com.jinsi.constant.YltConstant;
import com.jinsi.service.ylt.InfoCouponService;
import com.jinsi.util.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName InfoCouponController
 * @Content 优惠劵统计展示数据控制层
 * @Author 姚龙腾
 * @Date 2022/10/12 11:53
 */
@RestController
@Slf4j
public class InfoCouponController {

    @Autowired
    private InfoCouponService infoCouponService;

    /**
     * 获取每个优惠劵类型的数量
     * @return R
     */
    @RequestMapping("/getCouponCount")
    public R getCouponCount(){
        List<Integer> list = infoCouponService.getCouponCount();
        return R.custom(YltConstant.LAYUI_CODE,
                YltConstant.LAYUI_MSG,
                list,
                (long) list.size());
    }
}
